﻿<!DOCTYPE html>
{% load staticfiles %}
<html>
	<head>
		<meta charset="utf-8">
		<title>房天下 - 首页</title>
		<link type="text/css" rel="stylesheet" href="{% static 'css/style.css' %}">
		<style type="text/css">
			#headbar { position: relative; top: 5px; left: 350px; }
            #headbar a { vertical-align: bottom; text-decoration: none; }
			.count { display: inline-block; width: 25px; height: 25px; opacity: 0.7; background-color: black; position: relative; left: 60px; top: -40px; }
			.pub { display: inline-block; margin-left: 35px; background-color: rgb(180,0,5); height: 36px; }
			.pub a { display: inline-block; text-decoration: none; width: 125px; height: 36px; text-align: center; font-size: 16px; line-height: 36px; }
			.pub a:visited, .pub a:link { color: white; }
		</style>
	</head>
	<body>
		<div id="header" class="wrap">
			<div id="logo">
				<img src="{% static 'images/logo.png' %}">
			</div>
			<div id="headbar">
				{% if user_id %}
				<a href="">{{ real_name }}</a>&nbsp;&nbsp;
				<a href="/user/logout">注销</a>
				{% else %}
				<a href="/user/login">用户登录</a>
				{% endif %}
				<a href="/user/register">快速注册</a>
				<div class="pub">
                    {% if user_id %}
					<a href="/rent/publish">发布房源</a>
                    {% endif %}
				</div>

			</div>
		</div>
		<div id="navbar" class="wrap">
			<form method="post" action="" id='sform'>
                {% csrf_token %}
				<div class="search clearfix">
					<div class="fl">
						<ul>
							<li class="bold">房屋信息</li>
							<li>标题：
								<input type="text" class="text" name="title" value=""> 
								<label class="ui-blue"> 
								<input type="submit" name="search" value="搜索房屋">
							</label>
							</li>
						</ul>
					</div>
					<div class="fl">
						<ul>
							<li class="first">价格</li>
							<li>
								<select name='price' id='price'>
									<option value='不限'>不限</option>
									<option value='0-600'>600元以下</option>
									<option value='600-1000'>600元—1000元</option>
									<option value='1000-1500'>1000元—1500元</option>
									<option value='1500-2000'>1500元—2000元</option>
									<option value='2000-3000'>2000元—3000元</option>
									<option value='3000-5000'>3000元—5000元</option>
									<option value='5000-99999999'>5000元以上</option>
								</select>
							</li>
						</ul>
					</div>
					<div class="fl">
						<ul>
							<li class="first">房屋位置</li>
							<li>
                                省
								<select  id="prov" class="text" name="province.id">
									<option value="0">请选择</option>
									{% for prov in prov_list %}
									<option value="{{prov.prov_id}}">{{prov.prov_name}}</option>
									{% endfor %}
								</select>
                                市
								<select name='city' id='city'>
									<option value='0'>不限</option>
								</select>
                                区
								<select name='district' id='district'>
									<option value='0'>不限</option>
								</select>
							</li>
						</ul>
					</div>
					<div class="fl">
						<ul>
							<li class="first">房型</li>
							<li>
								<select name="houseType.id" id="houseType">
									<option value='0'>不限</option>
									{% for house_type in house_type_list %}
									<option value="${house_type.type_id}">${house_type.typename}</option>
									{% endfor %}
								</select>
							</li>
						</ul>
					</div>
					<div class="fl">
						<ul>
							<li class="first">面积</li>
							<li>
								<select name="area" id="area">
									<option value='不限'>不限</option>
									<option value='0-40'>40以下</option>
									<option value='40-80'>40-80</option>
									<option value='80-140'>80-140</option>
									<option value='140-200'>140-200</option>
									<option value='200-1000000'>200以上</option>
								</select>
							</li>
						</ul>
					</div>
				</div>
			</form>
		</div>
		<div class="main wrap">
			<table class="house-list">
				{% for house in house_list %}
				<tr>
					<td class="house-thumb">
						<div>
							<img src="{% static 'images/upload/house.main_photo' %}" width="160" height="120" alt="">
							<span class="count">1图</span>
						</div>
					</td>
					<td>
						<dl>
							<dt>
								<a href="">{{house.title}}</a>
							</dt>
							<dd>
								{{house.district.name}}&nbsp;{{house.street}}&nbsp;
								{{house.area}}平米&nbsp;{{house.floor}}层/{{house.total_floor}}层 <br>
								联系人：{{house.contact_name}}
								联系方式：{{house.contact_tel}}
							</dd>
						</dl>
					</td>
					<td class="house-type">{{house.house_type.name}}</td>
					<td class="house-price"><span>{{house.price}}</span>元/月</td>
				</tr>
				{% endfor %}
			</table>
			<div class="pager">
				<ul>
					<li class="current"><a href="?page=1">首页</a></li>
					{% if has_prev_page %}
					<li><a href="?page={{prev_page}}">上一页</a></li>
					{% endif %}
					{% if has_next_page %}
					<li><a href="page={{next_page}}">下一页</a></li>
					{% endif %}
					<li><a href="?page={{total_page}}">末页</a></li>
				</ul>
				<span class="total">{{current_page}}/{{total_page}}页</span>
			</div>
		</div>
		<div id="footer" class="wrap">
			<dl>
				<dt>&copy; 北京拓世宏业科技发展有限公司 版权所有</dt>
				<dd>京ICP备17002856号</dd>
				<dd>关于我们 · 联系方式 · 意见反馈 · 帮助中心</dd>
			</dl>
		</div>
	</body>
</html>